<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<% 
  add_crumb(t('#crumbs.people', "People"), context_url(@context, :context_users_url))
  add_crumb(t('#crumbs.prior_users', "Prior Users"))
  @active_tab="people"
%>
<% content_for :page_title, t('titles.prior_users', "Prior Users") %>

<% content_for :right_side do %>
  <a href="<%= context_url(@context, :context_users_url) %>" class="btn button-sidebar-wide">
    <i class="icon-arrow-left"></i>
    {{#t}}Back to People{{/t}}
  </a>
<% end %>

<% css_bundle :prior_users %>
<h1>{{#t}}Prior Users{{/t}}</h1>
<table id="users">
  <thead>
    <tr>
      <th scope="col">{{#t}}Name{{/t}}</th>
      <th scope="col">{{#t}}Type{{/t}}</th>
      <th scope="col">{{#t}}Total{{/t}}</th>
    </tr>
  </thead>
  <tbody>
    <% @prior_users.each do |user| %>
      <tr>
        <td class="name">
          <%= link_to(user.last_name_first, context_url(@context, :context_user_url, user.id)) %>
          <div class="email">
            <%= user.email %>
          </div>
        </td>
        <td class="type">
          <%= user.prior_enrollment.readable_type %>
        </td>
        <td class="score"><%= link_to(user.prior_enrollment.computed_final_score || '--', context_url(@context, :context_student_grades_url, user.id)) if user.prior_enrollment.student? %></td>
      </tr>
    <% end %>
  </tbody>
</table>
<%= will_paginate(@prior_users) %>
